<?php

/**
 * Pediatra form base class.
 *
 * @method Pediatra getObject() Returns the current form's model object
 *
 * @package    asindo
 * @subpackage form
 * @author     Ignacio Calvo
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BasePediatraForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'nombre'           => new sfWidgetFormInputText(),
      'apellido1'        => new sfWidgetFormInputText(),
      'apellido2'        => new sfWidgetFormInputText(),
      'fecha_alta'       => new sfWidgetFormDate(),
      'tipo_via'         => new sfWidgetFormInputText(),
      'via'              => new sfWidgetFormInputText(),
      'cp'               => new sfWidgetFormInputText(),
      'numero'           => new sfWidgetFormInputText(),
      'piso'             => new sfWidgetFormInputText(),
      'letra'            => new sfWidgetFormInputText(),
      'poblacion'        => new sfWidgetFormInputText(),
      'provincia'        => new sfWidgetFormInputText(),
      'email'            => new sfWidgetFormInputText(),
      'telefono1'        => new sfWidgetFormInputText(),
      'telefono2'        => new sfWidgetFormInputText(),
      'telefono3'        => new sfWidgetFormInputText(),
      'numero_colegiado' => new sfWidgetFormInputText(),
      'de_asindo'        => new sfWidgetFormInputCheckbox(),
      'observaciones'    => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'nombre'           => new sfValidatorString(array('max_length' => 255)),
      'apellido1'        => new sfValidatorString(array('max_length' => 255)),
      'apellido2'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'fecha_alta'       => new sfValidatorDate(array('required' => false)),
      'tipo_via'         => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'via'              => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'cp'               => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'numero'           => new sfValidatorInteger(array('required' => false)),
      'piso'             => new sfValidatorInteger(array('required' => false)),
      'letra'            => new sfValidatorString(array('max_length' => 2, 'required' => false)),
      'poblacion'        => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'provincia'        => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'email'            => new sfValidatorEmail(array('max_length' => 100, 'required' => false)),
      'telefono1'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'telefono2'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'telefono3'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'numero_colegiado' => new sfValidatorInteger(array('required' => false)),
      'de_asindo'        => new sfValidatorBoolean(array('required' => false)),
      'observaciones'    => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('pediatra[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Pediatra';
  }

}
